package com.medistat.model;

import java.util.Calendar;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.GenericGenerator;

import com.medistat.model.enums.WeekendDutiesInfoCreationPurpose;

@Entity
public class WeekendDutiesInfo extends StandardPersistentObject {
	@Id @GeneratedValue(generator="ID_GENERATOR_FOR_WEEKEND_DUTIES_INFO")
	@GenericGenerator(name="ID_GENERATOR_FOR_WEEKEND_DUTIES_INFO", strategy = "increment")
	private Long id;
	
	private Integer year;
	private Integer numberOfDuties;
	private String creationPurpose;
	private Calendar creationDate;
	private WeekendDutiesInfoCreationPurpose weekendDutiesInfoCreationPurpose;
	
	//parent - back reference
	@ManyToOne(targetEntity=Person.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="PersonID", referencedColumnName="ID") })	
	@Basic(fetch=FetchType.LAZY)
	private Person person;
	
	public Long getId() {
		return id;
	}

	public Integer getYear() {
		return year;
	}

	public void setYear(Integer year) {
		this.year = year;
	}

	public Integer getNumberOfDuties() {
		return numberOfDuties;
	}

	public void setNumberOfDuties(Integer numberOfDuties) {
		this.numberOfDuties = numberOfDuties;
	}

	public String getCreationPurpose() {
		return creationPurpose;
	}

	public void setCreationPurpose(String creationPurpose) {
		this.creationPurpose = creationPurpose;
	}

	public Calendar getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Calendar creationDate) {
		this.creationDate = creationDate;
	}
	
	public WeekendDutiesInfoCreationPurpose getWeekendDutiesInfoCreationPurpose() {
		return weekendDutiesInfoCreationPurpose;
	}

	public void setWeekendDutiesInfoCreationPurpose(WeekendDutiesInfoCreationPurpose weekendDutiesInfoCreationPurpose) {
		this.weekendDutiesInfoCreationPurpose = weekendDutiesInfoCreationPurpose;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}
}
